package dnl.jexem.cmd;

public enum ExecutionStatus {

    /**
     * Indicates that the execution is being prepared.
     */
    PRE_RUN(false),
    /**
     * Some problem happened before the execution process began.
     */
    CANNOT_EXECUTE(true),
    /**
     * Indicates that the process may still be running but has some kind of error. In most cases this means
     * that the process has failed and exited. Examples of such errors:
     * <ul>
     * <li> The process writes something to the standard error.
     * <li> An IOException occurred when reading from the process's IO streams.
     * </ul>
     */
    UNCERTAIN(true),
    /**
     * Currently running.
     */
    RUNNING(false),
    /**
     * Terminated (either normally or not).
     */
    TERMINATED(false);

    private final boolean mayIndicateErrors;

    private ExecutionStatus(boolean mayIndicateErrors) {
        this.mayIndicateErrors = mayIndicateErrors;
    }

    /**
     * if {@code true} this status implies the existence of errors.
     *
     * @return
     */
    public boolean mayIndicateErrors() {
        return mayIndicateErrors;
    }

}
